<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:head>

	<style>
.ui-widget,.ui-widget .ui-widget {
	font-size: 11px !important;
}
</style>
	<title>Consultar Compra</title>
	<link rel="stylesheet" type="text/css" href="css/estilos.css" />
</h:head>
<body>
	<h:form id="cCompraForm">
		<p:panel id="cCompraPanel" style="border: none;">
			<h2>Consultar Compras</h2>

			<h:panelGrid columns="3">
				<h:selectOneRadio id="cCompraTipoConsulta"
					value="#{beanCompra.campoValue}">
					<f:ajax event="change" listener="#{beanCompra.changeFild}"
						update="form" process="@this" />

					<f:selectItem itemLabel="Nota" itemValue="N" />
					<f:selectItem itemLabel="Serie" itemValue="S" />
					<f:selectItem itemLabel="Data de Emissao" itemValue="D" />
					<f:selectItem itemLabel="Fornecedor" itemValue="F" />
					<f:selectItem itemLabel="Valor Toral" itemValue="T" />
				</h:selectOneRadio>
			</h:panelGrid>

			<h:panelGrid columns="2" id="cCompraGridFild">

				<p:inputText id="cCompraFiltro" value="#{beanCompra.campoFiltro}"
					size="86" binding="#{beanCompra.texto}" />

				<p:commandButton id="cCompraFind" value="Buscar"
					icon="ui-icon-search" action="#{beanCompra.find}"
					update="cCompraCompras" />

			</h:panelGrid>

			<br></br>

			<p:separator />

			<p:outputPanel id="cCompraCompras">
				<p:dataTable value="#{beanCompra.compras}" var="compra"
					emptyMessage="Nenhuma Compra Encontrada">
					<p:column headerText="Nota">
						<h:outputText value="#{compra.nota}" />
					</p:column>
					<p:column headerText="Serie">
						<h:outputText value="#{compra.serie}" />
					</p:column>
					<p:column headerText="Fornecedor">
						<h:outputText value="#{compra.fornecedor.razaoSocial}" />
					</p:column>
					<p:column headerText="Valor Total">
						<h:outputText value="#{compra.total}" />
					</p:column>
					<p:column width="10">
						<p:commandButton icon="ui-icon-search" title="Detalhes"
							action="manterCompra">
							<f:setPropertyActionListener value="#{compra}"
								target="#{beanCompra.compra}" />
						</p:commandButton>
					</p:column>
				</p:dataTable>
			</p:outputPanel>

			<br />
			<p:separator />

			<h:panelGrid columns="3" style="float: right;">
				<p:commandButton id="cCompraNovo" value="Novo" title="Criar Compra"
					action="manterCompra" />
				<p:commandButton id="cCompraLimpar" value="Limpar"
					action="#{beanCompra.reinit}" update="cCompraForm" />
				<p:commandButton id="cCompraVoltar" value="Voltar"
					onclick="history.back()" />
			</h:panelGrid>
		</p:panel>
	</h:form>

</body>
</html>